
/* Generated by Interface Builder */

#import "Dice.h"
#import <stdio.h>
#import <appkit/Form.h>

extern int getrand(int MaxVal);


@implementation Dice

+ new
{
	self = [super new];
	maxValue = 6;
	return self;
}

- setValue:anObject
{
    value = anObject;
    return self;
}

- maxValue:sender
{
	maxValue = [sender floatValue];
	if (maxValue < 0) {
		printf("bad value");
		// NXAlert("bad value");
	}
    return self;
}

- roll:sender
{
	dieValue = getrand(maxValue);
	printf("%d\n", dieValue);
	[value setFloatValue: dieValue ];
    return self;
}


@end
